<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateGoodsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('goods', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name');
            $table->string('sub_title')->nullable();
            $table->string('cover_img')->nullable();
            $table->integer('category_id')->nullable()->comment('分类');
            $table->integer('brand_id')->nullable()->comment('品牌');
            $table->integer('shop_id')->nullable()->comment('店铺');
            $table->decimal('market_price')->default(0.00)->comment('商品的市场价');
            $table->decimal('price')->default(0.00)->comment('商品店铺价格');
            $table->integer('stock')->default(0)->comment('库存量');
            $table->boolean('is_hot')->default(0)->comment('是否是热销');
            $table->boolean('is_new')->default(0)->comment('是否是新品');
            $table->boolean('is_recommend')->default(0)->comment('是否是推荐商品');
            $table->boolean('is_index')->default(0)->comment('是否是首页推荐');
            $table->boolean('member_only')->default(0)->comment('是否是会员专属 1:是 0 :否');
            $table->boolean('status')->default(1)->comment('是否在销售');
            $table->integer('virtual_sales')->default(0)->comment('虚拟销量');
            $table->text('description')->comment('商品描述');
            $table->decimal('fees')->default(0);
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('goods');
    }
}
